local thbattle__huiyin_shouye = fk.CreateSkill {

  name = "thbattle__huiyin_shouye",

  tags = {  },

}



thbattle__huiyin_shouye:addEffect("active", {
  prompt = "#thbattle__huiyin_shouye",
  anim_type = "support",
  card_num = 1,
  card_filter =function (self, player, to_select, selected)
      return #selected < 1
  end,
  target_num = 1,
  target_filter =function (self, player, to_select, selected, selected_cards)
    return #selected == 0 and player ~= to_select
  end,
  can_use =function (self, player)
    return player:usedSkillTimes(thbattle__huiyin_shouye.name, Player.HistoryPhase) == 0 and not player:isNude()
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:recastCard(effect.cards, player, thbattle__huiyin_shouye.name)
    if not player:isNude() then
      local card = room:askForCard(player, 1, 1, true, thbattle__huiyin_shouye.name, false, nil, "#thbattle__huiyin_shouye-give:" .. target
        .id)
      room:obtainCard(target, card, false, fk.ReasonGive, player, thbattle__huiyin_shouye.name)
      if not target:isNude() then
        local use = room:askToPlayCard(target,{
          skill_name=thbattle__huiyin_shouye.name,
          prompt="#thbattle__huiyin_shouye-use",
          extra_data={ bypass_times = true },
          skip=true
        })
        if use then
          use.card.skillName = thbattle__huiyin_shouye.name
          room:useCard(use)
        else
          local card = room:askForCard(target, 1, 1, true, thbattle__huiyin_shouye.name, false, nil, "#thbattle__huiyin_shouye-recast")
          room:recastCard(card, target, thbattle__huiyin_shouye.name)
        end
      end
    end
  end
})

return thbattle__huiyin_shouye